package com.ruoyi.project.lely.bean.entity;

import com.baomidou.mybatisplus.annotation.*;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import javax.validation.constraints.Digits;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import org.hibernate.validator.constraints.Length;

/**
 * 分组讨论规则
 *
 * @author luoyong
 */
@Builder
@AllArgsConstructor
@NoArgsConstructor
@Data
@TableName(value = "`ly_groupon_rules`", autoResultMap = true)
public class LyGrouponRules {


    @ApiModelProperty("ID")
    @TableId("id")
    private Long id;


    @NotNull
    @ApiModelProperty("商品表的商品ID")
    @TableField(value = "`goods_id`")
    private Long goodsId;


    @Length(max = 127, message = "商品名称长度不能超过127位")
    @NotEmpty
    @ApiModelProperty("商品名称")
    @TableField(value = "`goods_name`")
    private String goodsName;


    @Length(max = 255, message = "商品图片或者商品货品图片长度不能超过255位")
    @ApiModelProperty("商品图片或者商品货品图片")
    @TableField(value = "`pic_url`")
    private String picUrl;


    @Digits(integer = 63 - 0, fraction = 0)
    @NotNull
    @ApiModelProperty("优惠金额")
    @TableField(value = "`discount`")
    private BigDecimal discount;


    @NotNull
    @ApiModelProperty("达到优惠条件的人数")
    @TableField(value = "`discount_member`")
    private Integer discountMember;


    @NotNull
    @ApiModelProperty("创建时间")
    @TableField(value = "`create_time`", fill = FieldFill.INSERT)
    private LocalDateTime createTime;


    @ApiModelProperty("更新时间")
    @TableField(value = "`update_time`", fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updateTime;


    @ApiModelProperty("团购过期时间")
    @TableField(value = "`expire_time`")
    private LocalDateTime expireTime;


    @ApiModelProperty("逻辑删除")
    @TableField(value = "`deleted`", fill = FieldFill.INSERT)
    private Integer deleted;

}
